package polyhedron;


import com.jme3.material.Material;
import com.jme3.math.FastMath;
import com.jme3.scene.Geometry;
import com.jme3.scene.Node;
import com.jme3.scene.shape.Box;
import com.jme3.scene.shape.Cylinder;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author ryan
 */
public class PlayerNode
{
    private PlayerNode() { }
    public static Node construct(String nodeName, Material playerMaterial, float height)
    {
        Node self;
        if(nodeName != null)
        {
            self = new Node(nodeName);
        }
        else
        {
            self = new Node("Player");
        }
        Cylinder playerModel = new Cylinder(16, 32, 0.5f, height, true);
        Geometry playerGeometry = new Geometry("Cylinder", playerModel);
        playerGeometry.rotate(FastMath.DEG_TO_RAD * 90f, 0, 0);
        playerGeometry.setMaterial(playerMaterial);
        self.attachChild(playerGeometry);
        return self;
    }
    public static Node constructFloor(String nodeName, Material floorMaterial)
    {
        Node self;
        if(nodeName != null)
        {
            self = new Node(nodeName);
        }
        else
        {
            self = new Node("Floor");
        }
        Box floorModel = new Box(10.0f, 0.3f, 1.0f);
        Geometry floorGeometry = new Geometry("Floor", floorModel);
        floorGeometry.setMaterial(floorMaterial);
        //floorGeometry.setLocalTranslation(0, -4, 0);
        self.attachChild(floorGeometry);
        return self;
    }
    public static Node constructWall(String nodeName, Material floorMaterial)
    {
        Node self;
        if(nodeName != null)
        {
            self = new Node(nodeName);
        }
        else
        {
            self = new Node("Wall");
        }
        Box floorModel = new Box(0.3f, 4.0f, 1.0f);
        Geometry floorGeometry = new Geometry("Wall", floorModel);
        floorGeometry.setMaterial(floorMaterial);
        self.attachChild(floorGeometry);
        return self;
    }
    public static Node constructObstacle(String nodeName, Material floorMaterial)
    {
        Node self;
        if(nodeName != null)
        {
            self = new Node(nodeName);
        }
        else
        {
            self = new Node("Obstacle");
        }
        Box floorModel = new Box(0.5f, 0.5f, 1.0f);
        Geometry floorGeometry = new Geometry("Obstacle", floorModel);
        floorGeometry.setMaterial(floorMaterial);
        self.attachChild(floorGeometry);
        return self;
    } 
}
